import { IsNotEmpty, IsString, Length } from 'class-validator';
import { IsEqualTo } from '../../common/validator/IsEqualTo.validator';

export class RegisterUserDto {
  @IsNotEmpty({ message: '账号不能为空' })
  @IsString({ message: '密码必须是字符串' })
  readonly account: string;

  @IsNotEmpty({ message: '密码不能为空' })
  @IsString({ message: '密码必须是字符串' })
  @Length(6, 20, { message: '密码必须在6-20位之间' })
  readonly password: string;

  @IsNotEmpty({ message: '密码不能为空' })
  @IsString({ message: '密码必须是字符串' })
  @Length(6, 20, { message: '密码必须在6-20位之间' })
  @IsEqualTo('password', {
    message: '密码不一致',
  })
  readonly rePassword: string;
}
